package com.ruoyi.project.manage.news.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.manage.news.mapper.DwAnimalNewsMapper;
import com.ruoyi.project.manage.news.domain.DwAnimalNews;
import com.ruoyi.project.manage.news.service.IDwAnimalNewsService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 动物趣闻Service业务层处理
 * 
 * @author mhg
 * @date 2021-10-04
 */
@Service
public class DwAnimalNewsServiceImpl implements IDwAnimalNewsService 
{
    @Autowired
    private DwAnimalNewsMapper dwAnimalNewsMapper;

    /**
     * 查询动物趣闻
     * 
     * @param id 动物趣闻主键
     * @return 动物趣闻
     */
    @Override
    public DwAnimalNews selectDwAnimalNewsById(Long id)
    {
        return dwAnimalNewsMapper.selectDwAnimalNewsById(id);
    }

    /**
     * 查询动物趣闻列表
     * 
     * @param dwAnimalNews 动物趣闻
     * @return 动物趣闻
     */
    @Override
    public List<DwAnimalNews> selectDwAnimalNewsList(DwAnimalNews dwAnimalNews)
    {
        return dwAnimalNewsMapper.selectDwAnimalNewsList(dwAnimalNews);
    }

    /**
     * 新增动物趣闻
     * 
     * @param dwAnimalNews 动物趣闻
     * @return 结果
     */
    @Override
    public int insertDwAnimalNews(DwAnimalNews dwAnimalNews)
    {
        dwAnimalNews.setCreateTime(DateUtils.getNowDate());
        return dwAnimalNewsMapper.insertDwAnimalNews(dwAnimalNews);
    }

    /**
     * 修改动物趣闻
     * 
     * @param dwAnimalNews 动物趣闻
     * @return 结果
     */
    @Override
    public int updateDwAnimalNews(DwAnimalNews dwAnimalNews)
    {
        return dwAnimalNewsMapper.updateDwAnimalNews(dwAnimalNews);
    }

    /**
     * 批量删除动物趣闻
     * 
     * @param ids 需要删除的动物趣闻主键
     * @return 结果
     */
    @Override
    public int deleteDwAnimalNewsByIds(String ids)
    {
        return dwAnimalNewsMapper.deleteDwAnimalNewsByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除动物趣闻信息
     * 
     * @param id 动物趣闻主键
     * @return 结果
     */
    @Override
    public int deleteDwAnimalNewsById(Long id)
    {
        return dwAnimalNewsMapper.deleteDwAnimalNewsById(id);
    }
}
